//
//  labelAndImageBtn.m
//  wfdyy
//
//  Created by  程 强 on 16/2/25.
//  Copyright © 2016年 demon. All rights reserved.
//

#import "labelAndImageBtn.h"

#import "JTCSM.h"

@implementation labelAndImageBtn

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (id)initWithFrame:(CGRect)frame buttonWithType:(UIButtonType)buttonType iamgeName:(NSString *)iamgeName title:(NSString *)title labelHegith:(CGFloat)labelHegith ImageWidth:(CGFloat)ImageWidth ImageHeight:(CGFloat)ImageHeight{
    self = [super initWithFrame:frame];
    if (self) {
        

        self.btnLabel = [UILabel initWithFrame:CGRectMake(0, 0, 0, 0) text:title font:16 textAlignment:NSTextAlignmentCenter texcolor:[UIColor whiteColor] backgroundColor:nil];
        [self addSubview:self.btnLabel];
        CGRect rect = [df labelHeightWithContent:title height:labelHegith label:self.btnLabel];
        self.btnLabel.frame = CGRectMake((frame.size.width -rect.size.width)/2+ImageWidth/2, (frame.size.height - labelHegith)/2, rect.size.width, labelHegith);
        
        self.btnIamgeV = [[UIImageView alloc]initWithFrame:CGRectMake(self.btnLabel.frame.origin.x - ImageWidth-8, (frame.size.height -ImageHeight)/2, ImageWidth, ImageHeight)];
        self.btnIamgeV.image = [UIImage imageNamed:iamgeName];
        [self addSubview:self.btnIamgeV];
    }
    return self;
}
@end
